<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"
      xmlns:p="http://primefaces.org/ui">

    <h:head>
        <meta http-equiv="content-Type" content="text/html; charset=UTF-8" />
        <h:outputStylesheet library="css" name="cssLayout.css"/>
        <h:outputStylesheet library="css" name="default.css"/>
        
        <h:outputStylesheet library="css" name="bordes.css"/>
        <h:outputStylesheet library="css" name="botones.css"/>
        <h:outputScript library="org.richfaces.staticResource" name="jquery-alternative-version.js" target="head"/>
        <h:outputScript library="js" name="jquery.validate.js"/>
        <h:outputStylesheet library="css" name="componentsCss.css"/>
        <title>Sigec</title>
        <script>
        /*<![CDATA[*/
	        function bloquearTeclas(e){
	        	var tecla;
	        	if (window.event) {
	        		//IE
	        		tecla = window.event.keyCode;
	        		if(tecla == 116 || tecla == 13){
	        			event.keyCode=0;
	        			event.returnValue=false;
	        		}
	        	}else{
	        		//firefox
	        		tecla = e.which;
	        		if(tecla == 116 || tecla==13)
	        			return true;
	        	}
	        }

	        
	        var count=#{session.maxInactiveInterval};
	    	
			var counter=setInterval(timer, 1000); //1000 will  run it every 1 second

			function timer() {
			  count=count-1;
			  if (count <= 0) {
			     //clearInterval(counter);
			     window.location = '#{facesContext.externalContext.requestContextPath}/salir.html';
			     //counter ended, do something here
			     return;
			  }
			  //Do code for showing the number of seconds here
			}

			function renovarTiempo(){
				count=#{session.maxInactiveInterval};
		    }
	        /*]]>*/
        </script>
        <script type="text/javascript">
			if(history.forward(1)){
				history.replace(history.forward(1));
			}
			//document.oncontextmenu = new Function("return false");
		</script>
		
        <a4j:outputPanel ajaxRendered="true">
	        <script>
	        	jQuery(document).ready(function(){
		        	
	        		$('.left_content').css({'height':($(window).height()-105)});
	        		$('#left').css({'height':($(window).height()-105)});
	        		$('.left_content').css({'overflow-y':'auto'});
	        		
	        	});
	        </script>
        </a4j:outputPanel>
        <h:outputStylesheet>
	        a>img {
	        	border: none;
	        }
	    </h:outputStylesheet>
	    
    </h:head>

    <h:body style="background-image: url('#{resource['images:Bottom_texture.jpg']}');" onkeydown="if(bloquearTeclas(event)) return false;">
		
        <h:panelGroup layout="block" id="top" style="text-align:center; width:100%" styleClass="roundSigec">
        	<h:panelGrid columns="3" style="text-align:center" width="100%">
        		<h:outputLabel value="#{msg['sigec']}" style="font-size:24px; color:#183637;" rendered="false"/>
        		<h:panelGrid columns="2">
        			<h:outputLabel value="Bienvenido :" style="color: blue;"/>
        			<h:outputText value="#{homeSessionController.usuarioPerfil.persona.primerNombre} #{homeSessionController.usuarioPerfil.persona.primerApellido}"  style="float:right; color: blue;"/>
        			<span id="timer" class="timer"/>
        		</h:panelGrid>
        		
            	<a4j:commandButton value="#{msg['cerrar_sesion']}" action="#{loginController.btnLogOut}" styleClass="btnAux logoutBtn"
            		execute="@this" style="float:right;" immediate="true" limitRender="true" />
        	</h:panelGrid>
            
        </h:panelGroup>
        
        <h:panelGroup layout="block">
            <h:panelGroup layout="block" id="left">
            	
                <ui:insert name="left">
                	menu sigec
                </ui:insert>
            </h:panelGroup>
            <h:panelGroup id="content" class="left_content" style=" overflow-y:auto;" layout="block">
            	<rich:notifyMessages ajaxRendered="true"></rich:notifyMessages>
                <ui:insert name="content">Content</ui:insert>
            </h:panelGroup>
        </h:panelGroup>
        
        <h:panelGroup id="bottom" layout="block">
            <ui:insert name="bottom">
            	<h:outputLabel value="#{msg.bottom_UEC}" style="color:red; text-align:center;"/> 
            </ui:insert>
        </h:panelGroup>

	<a4j:status onstart="#{rich:component('statusPanel')}.show();" onstop="#{rich:component('statusPanel')}.hide(); renovarTiempo();" />
    
    <rich:popupPanel id="statusPanel" autosized="true" header="#{msg.status_procesando}">
		<h:graphicImage library="images" name="ajax_status.gif" />
	</rich:popupPanel>
	
	<p:ajaxStatus onstart="statusDialog.show();" oncomplete="statusDialog.hide(); renovarTiempo();"/>  
	<p:dialog modal="true" widgetVar="statusDialog" header="#{msg.status_procesando}" draggable="false" closable="false">
		<h:graphicImage library="images" name="ajax_status.gif" />
	</p:dialog> 

    </h:body>

</html>
